{% load i18n %}
{% load promgen %}
<div class="panel-group">
  <div class="panel panel-default">
    <div class="panel-body">
      <table class="table table-bordered">
        <tr>
          <th>User</th>
          <th>Email</th>
          <th>Role</th>
          <th>Actions</th>
        </tr>
        {% for user,perms in object|get_users_roles %}
          {% include "promgen/group_user_row.html" %}
        {% endfor %}
      </table>
    </div>
  </div>

  <div class="panel panel-footer">
    <div class="panel-heading">
      <h4>Add Members</h4>
    </div>
    <div class="panel-body">
      <div>
        <form method="post" action="{% url 'group-add-member' object.id %}">
          {% csrf_token %}
          <input
            name="next"
            type="hidden"
            value="{{ request.get_full_path }}#members"
          />
          <input name="model" type="hidden" value="{{ object | klass }}" />
          <input name="id" type="hidden" value="{{ object.id }}" />
          <input name="permission" type="hidden" value="{{ object.id }}" />
          <table class="table">
            <tr>
              <th class="col-md-2">{{ group_member_form.permission.label }}</th>
              <td>{{ group_member_form.permission }}</td>
            </tr>
            <tr>
              <th class="col-md-2">{{ group_member_form.users.label }}</th>
              <td>{{ group_member_form.users }}</td>
            </tr>
          </table>
          <div>
            <button class="btn btn-primary">Add</button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
